#
# $Id: Makefile.in,v 1.13 2000/01/11 21:18:03 jpr5 Exp $
#

CC=@CC@

INCLUDES=-I@srcdir@ @PCAP_INCLUDE@
CFLAGS=@CFLAGS@ @DEFS@ 
LIBS=-lpcap @EXTRA_LIBS@

SRC=ngrep.c regex.c
OBJS=ngrep.o regex.o
TARGET=ngrep
MANPAGE=ngrep.8

INSTALL=./install-sh
BINDEST=@prefix@/bin
MANDEST=@prefix@/man/man8

$(TARGET): $(OBJS) 
	$(CC) $(CFLAGS) -s -o $(TARGET) $(OBJS) $(LIBS) 

debug: $(OBJS)
	$(CC) $(CFLAGS) -g -o $(TARGET) $(OBJS) $(LIBS) 

static: $(OBJS)
	$(CC) $(CFLAGS) -static -o $(TARGET).static $(OBJS) $(LIBS) 

install: $(TARGET)
	$(INSTALL) -c -m 0755 $(TARGET) $(BINDEST)
	$(INSTALL) -c -m 0644 $(MANPAGE) $(MANDEST)

.c.o:	
	$(CC) $(CFLAGS) $(INCLUDES) -g -c $<

clean:
	rm -f *~ *.o $(TARGET) config.status config.cache config.log

test:
	mv -f html RCS ..
	(cd ..; tar zcvf ngrep-`cat ngrep/ngrep.c | grep Revision | sed 's/^.*Revision: \(.*\) .*$$/\1/'`-test.tar.gz ngrep)
	mv -f ../html ../RCS .

ngrep.o: ngrep.c ngrep.h
regex.o: regex.c regex.h
